#include<bits/stdc++.h>
using namespace std;

vector<int>arr = { 1,2,3,4,5,6,7,8,9,10 };

int halffind(int target) {
    int l = 0, r = arr.size() - 1;
    while (l <= r) {
        int mid = (r - l) / 2 + l;
        if (arr[mid] > target) {
            r = mid - 1;
        }
        else if (arr[mid] < target){
            l = mid + 1;
        }
        else {
            return mid;
        }

    }
}
int main() {
    cout << halffind(9);
    return 0;
}
